/*gilsCSDg/UUL5pPBtYT53wKnPxjYKGXJJ2VsN/mJODOiGT9mC7+HehtXp5zx6Guk*/
/*
 * @Descripttion:
 * @version:
 * @Author: Chendch
 * @Date: 2019-06-08 15:55:18
 * @LastEditors: Chendch
 * @LastEditTime: 2021-06-10 16:00:59
 */
import { ajax } from 'nc-lightapp-front';

const queryAttachments =  '/nccloud/platform/attachment/query.do';

export default function (bilId) {

    const params = {
        billId: bilId,
        fullPath: bilId
      };
    return  new Promise((resolve, reject) => {

        ajax({
            url: queryAttachments,
            data: params,
            success: res => {
              let { success, data } = res;
              if (success) {
                    if (Object.prototype.toString.call(data) === '[object Array]') {
                    resolve(data.length);
                    } else {
                        resolve(res);
                    }
              } else {
                  console.warn('ajax请求错误');
                  // eslint-disable-next-line prefer-promise-reject-errors
                  reject('ajax请求错误');
              }
            }
          });
    });

}


/*gilsCSDg/UUL5pPBtYT53wKnPxjYKGXJJ2VsN/mJODOiGT9mC7+HehtXp5zx6Guk*/
